<template>
    <div class="code-view">
        <v-md-preview :text="code"></v-md-preview>
    </div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import useFile from '../../hooks/useFile'
type PropsType = {
    file: string
}
const props = defineProps<PropsType>()
const { getFile } = useFile()
const code = ref('')
onMounted(async () => {
    const { result } = await getFile(props.file)
    if (result) {
        code.value = result
    }
})
</script>
<style scoped>
.code-view {
    color: #2c3e50;
    text-align: left;
    position: relative;
}
</style>